import time
import random
a = open('m1_sorted.txt','r')
a1 = open('m2_reverse.txt','r')
a2 = open('m3_shuffle.txt','r')
name0 = a.name.split(".")[0]
name1 = a1.name.split(".")[0]
name2 = a2.name.split(".")[0]

a = a.read().split()
a = [int (i) for i in a]
a1 = a1.read().split()
a1 = [int (i) for i in a1]
a2 = a2.read().split()
a2 = [int (i) for i in a2]
def sort(a):
    for j in range(1,len(a)):
        for i in range(len(a)-j):
            if a[i]>a[i+1]:
                a[i],a[i + 1]=a[i+1],a[i]
st = time.time()
sort(a)
pr = time.time()
pr1 = time.time()
sort(a1)
pr1 = time.time()
pr2 = time.time()
sort(a2)
pr2 = time.time()
print('m1_sorted',round((pr-st)*1000),"milliseconds")
print('m2_reverse',round((pr1-pr1)*1000),"milliseconds")
print('m3_shuffle',round((pr2-pr2)*1000),"milliseconds")